From f45d151eabaeb610c09c919f9927bde157bcfa11 Mon Sep 17 00:00:00 2001 From: "djm@kirby.fc.hp.com" Date: Wed, 23 Nov 2005 14:43:05 -0600 Subject: [PATCH] vcpu_regs defined in ptrace.h (get regs from vcpu). Manual conversions and duplicate declarations removed. (by Tristan Gingold) --- xen/arch/ia64/xen/domain.c | 8 ++++---- xen/arch/ia64/xen/vcpu.c | 1 - xen/arch/ia64/xen/xenmisc.c | 2 +- xen/include/asm-ia64/linux-xen/asm/ptrace.h | 13 +++++++++++++ xen/include/asm-ia64/vmx_vcpu.h | 2 -- 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/xen/arch/ia64/xen/domain.c b/xen/arch/ia64/xen/domain.c index bca625d77b..b6fc57a450 100644 --- a/xen/arch/ia64/xen/domain.c +++ b/xen/arch/ia64/xen/domain.c @@ -165,7 +165,7 @@ void free_vcpu_struct(struct vcpu *v) static void init_switch_stack(struct vcpu *v) { - struct pt_regs *regs = (struct pt_regs *) ((unsigned long) v + IA64_STK_OFFSET) - 1; + struct pt_regs *regs = vcpu_regs (v); struct switch_stack *sw = (struct switch_stack *) regs - 1; extern void ia64_ret_from_clone; @@ -253,7 +253,7 @@ void arch_do_createdomain(struct vcpu *v) void arch_getdomaininfo_ctxt(struct vcpu *v, struct vcpu_guest_context *c) { - struct pt_regs *regs = (struct pt_regs *) ((unsigned long) v + IA64_STK_OFFSET) - 1; + struct pt_regs *regs = vcpu_regs (v); printf("arch_getdomaininfo_ctxt\n"); c->regs = *regs; @@ -264,7 +264,7 @@ void arch_getdomaininfo_ctxt(struct vcpu *v, struct vcpu_guest_context *c) int arch_set_info_guest(struct vcpu *v, struct vcpu_guest_context *c) { - struct pt_regs *regs = (struct pt_regs *) ((unsigned long) v + IA64_STK_OFFSET) - 1; + struct pt_regs *regs = vcpu_regs (v); struct domain *d = v->domain; int i, rc, ret; unsigned long progress = 0; @@ -335,7 +335,7 @@ void new_thread(struct vcpu *v, if (d == dom0) start_pc += dom0_start; #endif - regs = (struct pt_regs *) ((unsigned long) v + IA64_STK_OFFSET) - 1; + regs = vcpu_regs (v); if (VMX_DOMAIN(v)) { /* dt/rt/it:1;i/ic:1, si:1, vm/bn:1, ac:1 */ regs->cr_ipsr = 0x501008826008; /* Need to be expanded as macro */ diff --git a/xen/arch/ia64/xen/vcpu.c b/xen/arch/ia64/xen/vcpu.c index 4aa50eea40..b73467d271 100644 --- a/xen/arch/ia64/xen/vcpu.c +++ b/xen/arch/ia64/xen/vcpu.c @@ -33,7 +33,6 @@ typedef union { // this def for vcpu_regs won't work if kernel stack is present //#define vcpu_regs(vcpu) ((struct pt_regs *) vcpu->arch.regs -#define vcpu_regs(vcpu) (((struct pt_regs *) ((char *) (vcpu) + IA64_STK_OFFSET)) - 1) #define PSCB(x,y) VCPU(x,y) #define PSCBX(x,y) x->arch.y diff --git a/xen/arch/ia64/xen/xenmisc.c b/xen/arch/ia64/xen/xenmisc.c index aa8ca1124c..76be33532e 100644 --- a/xen/arch/ia64/xen/xenmisc.c +++ b/xen/arch/ia64/xen/xenmisc.c @@ -72,7 +72,7 @@ int grant_table_create(struct domain *d) { return 0; } void grant_table_destroy(struct domain *d) { return; } #endif -struct pt_regs *guest_cpu_user_regs(void) { return ia64_task_regs(current); } +struct pt_regs *guest_cpu_user_regs(void) { return vcpu_regs(current); } void raise_actimer_softirq(void) { diff --git a/xen/include/asm-ia64/linux-xen/asm/ptrace.h b/xen/include/asm-ia64/linux-xen/asm/ptrace.h index ef8bcaef79..a07b305961 100644 --- a/xen/include/asm-ia64/linux-xen/asm/ptrace.h +++ b/xen/include/asm-ia64/linux-xen/asm/ptrace.h @@ -98,6 +98,19 @@ #ifdef XEN #include #define pt_regs cpu_user_regs + +/* User regs at placed at the end of the vcpu area. + Convert a vcpu pointer to a regs pointer. + Note: this is the same as ia64_task_regs, but it uses a Xen-friendly name. +*/ +struct vcpu; +static inline struct cpu_user_regs * +vcpu_regs (struct vcpu *v) +{ + return (struct cpu_user_regs *) ((unsigned long) v + IA64_STK_OFFSET) - 1; +} + + #else struct pt_regs { /* The following registers are saved by SAVE_MIN: */ diff --git a/xen/include/asm-ia64/vmx_vcpu.h b/xen/include/asm-ia64/vmx_vcpu.h index 2ac3532e38..4f90175525 100644 --- a/xen/include/asm-ia64/vmx_vcpu.h +++ b/xen/include/asm-ia64/vmx_vcpu.h @@ -44,8 +44,6 @@ #define VRN7 0x7UL // for vlsapic #define VLSAPIC_INSVC(vcpu, i) ((vcpu)->arch.insvc[i]) -// this def for vcpu_regs won't work if kernel stack is present -#define vcpu_regs(vcpu) (((struct pt_regs *) ((char *) (vcpu) + IA64_STK_OFFSET)) - 1) //#define VMX_VPD(x,y) ((x)->arch.arch_vmx.vpd->y) #define VMX(x,y) ((x)->arch.arch_vmx.y) -- 2.30.2